package time.after.time.sys.statics;

import org.springframework.security.authentication.encoding.Md5PasswordEncoder;

import time.after.time.sys.ConstHolder;

/**
 * 
 * @author HuMing create in 2012-2-16
 */
public class PasswordHandler {

	/**
	 * 动态加密盐
	 * @param pwd
	 * @return 加密后匹配数据库的密码
	 */
	public static String getSaltSourceCode(String pwd)
	{
		Md5PasswordEncoder md5 = new Md5PasswordEncoder();
		md5.setEncodeHashAsBase64(false);
		String salt=ConstHolder.get("SYS_KEY");
		return md5.encodePassword(pwd,salt);
	}
	
}
